import { get, post, put, deleteApi, deleteOne } from '@/utils/api'

export function roleOptions() {
    return get('/admin/roles/options')
}

export function roleEffectiveOptions() {
    return get('/admin/roles/effective/options')
}

export function pageQuery(queryParams) {
    return get('/admin/roles/page', queryParams)
}

export function roleRightPageQuery(queryParams) {
    return get('/admin/roles/right/page', queryParams)
}

export function insert(data) {
    return post('/admin/roles', data)
}

export function grantRoleRightPermission(data) {
    return post('/admin/roles/grant', data)
}

export function update(data) {
    return put('/admin/roles', data)
}

export function deleteData(ids) {
    return deleteApi('/admin/roles', ids)
}

export function deleteOneRow(id) {
    return deleteOne(`/admin/roles/${id}`)
}

export function delRoleAllRight(roleId) {
    return deleteOne(`/admin/roles/right/all/${roleId}`)
}

export function delRowRightGroup(data) {
    return deleteApi('/admin/roles/right/group', data)
}

export function delRowRight(data) {
    return deleteApi('/admin/roles/right', data)
}

export function delRowPermission(data) {
    return deleteApi('/admin/roles/permission', data)
}